package day10.LX.ZhuanHuan;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Text {
    public static void main(String[] args) {
        ArrayList<String>list=new ArrayList<>();
        list.add("张三丰,23");
        list.add("张无忌,24");
        list.add("张翠山,50");
        list.add("小龙女,26");
        Stream<String> stream = list.stream();
        List<Student>list1=stream.map(new Function<String, Student>() {
            @Override
            public Student apply(String s) {
                String[] strs = s.split(",");
                String name = strs[0];
                int age = Integer.parseInt(strs[1]);
                Student stu=new Student(name,age);
                return stu;
            }
        }).collect(Collectors.toList());
        System.out.println(list1);
    }
}
